#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solve()
{
    int n, q;
    cin >> n >> q;
    set<int> s;
    for (int i = 1; i <= n; i++) s.insert(i);
    vector<int> a(n + 1, 0);
    int k = 1;
    while (q--)
    {
        int op;
        cin >> op;
        if (op == 1)
        {
            int l, r;
            cin >> l >> r;
            auto it = s.lower_bound(l);
            while (it != s.end() && *it <= r)
            {
                a[*it] = k++;
                it = s.erase(it);
            }
        }
        else
        {
            int x;
            cin >> x;
            cout << a[x] << endl;
        }
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}